package spike.pool.implementations;

import spike.pool.interfaces.ConnectionPool;
import spike.pool.interfaces.ConnectionSource;
import spike.pool.interfaces.PoolFactory;

import java.util.concurrent.TimeUnit;

/**
 * Created by Julia on 07.12.2014.
 */
public class PublicPoolFactory <T> implements PoolFactory <T> {

    @Override
    public ConnectionPool<T> newConnectionPool(int capacity, ConnectionSource<T> src) {
        return new PublicConnectionPool<>(capacity, capacity, Long.MAX_VALUE, TimeUnit.MILLISECONDS, src);
    }

    @Override
    public ConnectionPool<T> newConnectionPool(int init, int max, long keepAliveTime, TimeUnit unit, ConnectionSource<T> src) {
        return new PublicConnectionPool<>(init, max, keepAliveTime, unit, src);
    }
}
